/*
Source : https://leetcode.com/problems/count-of-smaller-numbers-after-self/
Author : nflush@outlook.com
Date   : 2016-07-05
*/

/*
315. Count of Smaller Numbers After Self

    Total Accepted: 13084
    Total Submissions: 41600
    Difficulty: Hard

You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i].

Example:

Given nums = [5, 2, 6, 1]

To the right of 5 there are 2 smaller elements (2 and 1).
To the right of 2 there is only 1 smaller element (1).
To the right of 6 there is 1 smaller element (1).
To the right of 1 there is 0 smaller element.

Return the array [2, 1, 1, 0].

Subscribe to see which companies asked this question
*/

class Solution {
typedef struct treeNode {
    int num;
    int set;
}Node;
private:
    // n1 <= n2
    void insertNode(Node *set, int n1, int n2, int count){
        int mid = count/2;
        int low = 0;
        int high = count;
        while (high > low){
            mid = low + (high-low)/2;
            if (set[mid].num > n1){
                low = mid +1;
            } else if (set[mid].num < n1){
                high = mid-1;
            } else {
                break;
            }
        }
    }
public:
    vector<int> countSmaller(vector<int>& nums) {
        vector<int> ret(nums.size());
        Node *set = new Node[nums.size()];
        int max = nums.size();
        
        for (int i = 0; i < max; i++){
            ret[i] = 
        }
        delete [] set;
        return ret;
    }
};

